package com.suineg.pms.entity.base;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.google.common.collect.Lists;
import com.suineg.pms.entity.IdEntity;
import com.suineg.pms.entity.User;


/**
 * 小区
 *@author Suine
 */
@Entity
@Table(name = "pms_community")
public class Community extends IdEntity{
	/** 小区名 */
	private String name;
	/** 地址 */
	private String address;
	/** 占地面积 */
	private Double area;
	/** 开工时间 */
	private Date kaigongDate;
	/** 竣工时间 */
	private Date jungongDate;
	/** 物业公司  */
	private Company company;
	/** 操作人 */
	private User opuser;
	/** 操作时间 */
	private Date opdate;
	/** 楼栋 */
	List<Building> buildingList = Lists.newArrayList();
	/** 车位集合 */
	private List<Paking> pakingList = Lists.newArrayList();
	
	public Community() {
	}
	@OneToMany(fetch = FetchType.LAZY,mappedBy = "community")
	@OrderBy("id")
	public List<Paking> getPakingList() {
		return pakingList;
	}
	public void setPakingList(List<Paking> pakingList) {
		this.pakingList = pakingList;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public Double getArea() {
		return area;
	}
	public void setArea(Double area) {
		this.area = area;
	}
	public Date getKaigongDate() {
		return kaigongDate;
	}
	public void setKaigongDate(Date kaigongDate) {
		this.kaigongDate = kaigongDate;
	}
	public Date getJungongDate() {
		return jungongDate;
	}
	public void setJungongDate(Date jungongDate) {
		this.jungongDate = jungongDate;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "company_id")
	public Company getCompany() {
		return company;
	}
	public void setCompany(Company company) {
		this.company = company;
	}
	@ManyToOne
	public User getOpuser() {
		return opuser;
	}
	public void setOpuser(User opuser) {
		this.opuser = opuser;
	}
	public Date getOpdate() {
		return opdate;
	}
	public void setOpdate(Date opdate) {
		this.opdate = opdate;
	}
	@OneToMany(fetch = FetchType.LAZY,mappedBy = "community")
	@OrderBy("name")
	public List<Building> getBuildingList() {
		return buildingList;
	}
	public void setBuildingList(List<Building> buildingList) {
		this.buildingList = buildingList;
	}
	
	
}

